home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-03-06 | 1.6 KB | 35 lines | [TEXT/GEOL] |
- Item 2371253 25-Aug-90 14:46PDT
-
- From: D2605 Xanadu Operating,Marc Stiegler,PRT
-
- To: POWERUP.ENG Power Up Software,PRT
-
- cc: MACAPP.TECH$ MacApp Technical
-
- Sub: Re: Multiple Inheritance Ques
-
- James,
- A simple solution to this problem is to have a the class you referred to as
- TCard simply maintain a front and back, rather than inherit from two classes.
- You don't need multiple inheritance for this example (or almost anything else).
- As a possible solution to the 'security' problem, the part of the
- application that creates the opponents card representations would wrap the
- opponent's cards (or any card which has the front hidden) with an object that
- will return the back, but when asked for the front would inform the opponent of
- an attempt to cheat. This TBackOnlyCard class would be derived from the TCard
- class and would point to a TCard. Similarly, a THiddenCard class would point
- to a TCard, but not allow access to the back OR front (for those cards still in
- the deck). All of these classes would be derived from a common abstract
- superclass.
- This 'wrapping' of an object (or multiple objects) is a very simple way to
- avoid multiple inheritance in almost any situation. It does alter some
- protocol in some situations because a client of the class will need to ask for
- a particular aspect of the object before getting the details. In this
- particular case, protocol change is not necessary.
-
- Singly Inheritingly Yours,
-
- --Hugh Hoover
- Xanadu Operating Company
-
-